package yunhe.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import yunhe.biz.IProcureBiz;
import yunhe.biz.impl.ProcureBizImpl;
import yunhe.entity.Product;
@WebServlet(name="SelectProductServlet",urlPatterns="/SelectProductServlet")
public class SelectProductServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType("text/html;charset=utf-8");
		String proBarCode=request.getParameter("proBarCode");
		Product product=new Product();
		product.setProBarCode(proBarCode);
		IProcureBiz ipb=new ProcureBizImpl();
		Product product1=ipb.getByProBarCode(product);
		PrintWriter out=response.getWriter();
		if(product1!=null){
			out.print(true);
		}else{
			out.print(false);
		}
	}
	
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		
		doGet(req, resp);
	}
}
